<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CSC560 Design and Analysis of Real-Time Systems</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="../default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
	<div id="header">
		<h1>CSC560</h1>
		<h2>Design and Analysis of Real-Time Systems</h2>
		<ul>
			<li class="first">
				<a href="../index.html" accesskey="1" title="">Home</a>
			</li>
			<li>
				<a href="../project1/index.html" accesskey="2" title="">Project 1</a>
			</li>
			<li>
				<a href="index.html" accesskey="3" title=""><b>Project 2</b></a>
			</li>
			<li>
				<a href="../project3/index.html" accesskey="4" title="">Project 3</a>
			</li>
			<li>
				<a href="../project4/index.html" accesskey="4" title="">Project 4</a>
			</li>
			<li>
				<a href="../project5/index.html" accesskey="4" title="">Project 5</a>
			</li>
		</ul>
	</div>
</div>
<div id="content">
	<div id="colOne">
		<h2>Event Coordinated Scheduling</h2>
		<h3>Use events to coordinate tasks </h3>
		<p>
			All tasks had the same scheduling policies assigned as in the System/Round Robin section. The requirement was to use events to 
			synchronize them. To take advantage of events, we altered our system behavior slightly as the following: 
			<br><br>
			The main function created the joystick task, radio transmission task, radio receiving task, and uart task. In addition, the main function created three events,
			'sendEvent' for sending a packet, 'receiveEvent' for the receiving of a status packet, and 'printEvent' for the uart to print the speed. The role of the joystick task was to assert
			that a joystick movement was detected, prepare a SCI command, and signal the radio transmission task that a packet is ready for transmission. 
			The radio receiving task simply waited on the 'receiveEvent'. The interrupt service routine (ISR) for receiving a packet signals the radio receive task that a packet has arrived.
			The radio receiving task reads the packet and signal 'printEvent' whenever the 'receiveEvent' was signaled by the 
			corresponding ISR. Lastly, UART task waited on the 'printEvent' and it printed out the speed information 
			whenever the printEvent was signaled. Note that unlike in the previous section where no events were used, the radio receiving task here was created only 
			once to take advantage of using events to synchronize tasks.
		</p>
		
		<p>
			The following diagram shows the scheduling of tasks for this part of the project.
		</p>
		<p>
			<a href="../images/event_new.jpg">
			<img src="../images/event_new.jpg" alt="Event Coordinated diagram" width="100%" />	</a>
		</p>
		<p>
			Note that initially we took a different approach where main() created only two events, receiveEvent and printEvent, and 
			a Radio Trasmission task was created on the fly. That is, whenever the joystick task was executing and asserted 
			that a joystick movement was detected and a SCI command needed to be sent, a Radio Transmission task was then 
			created. Nevertheless, after consulting with Professor Mantis Cheng, 
			we decided to modify our design as mentioned above where the radio transmission task was created by main() for 
			once only. This change was necessary because it was more expensive to have the RTOS create a system task 
			on the fly especially when there were many SCI commands to be sent frequently. It also followed that a new event, 
			sendEvent, had to be created to synchronize the Radio Transmission task. The Radio Tranmission task would wait on 
			the sendEvent, and whenever there was a packet to be sent the Joystick task would signal the sendEvent so the 
			Radio Transmission task would resume to send out the packet. 
		</p>
		<p>
			The following diagram shows the scheduling of tasks where a Radio Transmission task is created every time a joystick 
			command is to be sent.
		</p>
		<p>
			<a href="../images/event_old.jpg">
			<img src="../images/event_old.jpg" alt="Event Coordinated diagram" width="100%" />	</a>
		</p>

	</div>
	
	<div id="colTwo">
		<h3>Project Sections</h3>
		<ul>
			<li class="first"><a href="part1.html">Time Measurements</a></li>
			<li>	<a href="part2.html">Scheduling Tasks with RTOS</a></li>
			<li>-	<a href="part2sub1.html">Periodic</a></li>
			<li>-	<a href="part2sub2.html">System and Round Robin</a></li>
			<li>-	<a href="part2sub3.html">Event Coordinated</a></li>
			<li>	<a href="doxygen/html/index.html">Doxygen</a></li>
			<li><a href="http://code.google.com/p/wireless-roomba">Google Code</a></li>
		</ul>
	</div>
</div>
<div id="footer">
	<p>@ 2009. All Rights Reserved. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
</div>
</body>
</html>
